// pages/points-mall/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    currentTab: 0,  //对应样式变化
    scrollTop: 0,  //用作跳转后右侧视图回到顶部
    screenArray: [
      {
        screenId:1,
        screenName:'有声书'
      },
      {
        screenId: 2,
        screenName: '畅销书'
      },
      {
        screenId: 3,
        screenName: '儿童'
      },
      {
        screenId: 4,
        screenName: '相声评书'
      },
      {
        screenId: 5,
        screenName: '情感生活'
      },
      {
        screenId: 6,
        screenName: '人文'
      },
      {
        screenId: 7,
        screenName: '历史'
      },
      {
        screenId: 8,
        screenName: '国书学院'
      },
      {
        screenId: 9,
        screenName: '音乐'
      },
      {
        screenId: 10,
        screenName: '英语'
      },
      {
        screenId: 11,
        screenName: '教育培训'
      },
      {
        screenId: 12,
        screenName: '军事天地'
      }
    ], //左侧导航栏内容
    screenId: "",  //后台查询需要的字段
    childrenArray: {
      childrenScreenArray: [
        {
          screenName: '有声书',
          childrenScreenArray: [
            {
              screenId: 1,
              screenName: '言情'
            },
            {
              screenId: 2,
              screenName: '悬疑'
            },
            {
              screenId: 3,
              screenName: '都市'
            },
            {
              screenId: 4,
              screenName: '玄幻'
            },
            {
              screenId: 5,
              screenName: '武侠'
            },
            {
              screenId: 6,
              screenName: '历史'
            },
          ]
        },
        {
          screenName: '畅销书',
          childrenScreenArray: [
            {
              screenId: 1,
              screenName: '言情'
            },
            {
              screenId: 2,
              screenName: '悬疑'
            },
            {
              screenId: 3,
              screenName: '都市'
            },
            {
              screenId: 4,
              screenName: '玄幻'
            },
            {
              screenId: 5,
              screenName: '武侠'
            },
            {
              screenId: 6,
              screenName: '历史'
            },
          ]
        },
        {
          screenName: '儿童',
          childrenScreenArray: [
            {
              screenId: 1,
              screenName: '言情'
            },
            {
              screenId: 2,
              screenName: '悬疑'
            },
            {
              screenId: 3,
              screenName: '都市'
            },
            {
              screenId: 4,
              screenName: '玄幻'
            },
            {
              screenId: 5,
              screenName: '武侠'
            },
            {
              screenId: 6,
              screenName: '历史'
            },
          ]
        },
        {
          screenName: '相声评书',
          childrenScreenArray: [
            {
              screenId: 1,
              screenName: '言情'
            },
            {
              screenId: 2,
              screenName: '悬疑'
            },
            {
              screenId: 3,
              screenName: '都市'
            },
            {
              screenId: 4,
              screenName: '玄幻'
            },
            {
              screenId: 5,
              screenName: '武侠'
            },
            {
              screenId: 6,
              screenName: '历史'
            },
          ]
        },
      ]
    }, //右侧内容
  },
  // 事件处理函数
  navbarTap: function (e) {
    var that = this;
    console.log(e);
    this.setData({
      currentTab: e.currentTarget.id,   //按钮CSS变化
      screenId: e.currentTarget.dataset.screenid,
      scrollTop: 0,   //切换导航后，控制右侧滚动视图回到顶部
    })
    //刷新右侧内容的数据
    var screenId = this.data.screenId;

  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})